From: Colin Walters Date: Wed, 13 Jul 2022 19:38:59 +0000 (-0400) Subject: sysroot: Add a few more assertions about `boot_fd` X-Git-Tag: archive/raspbian/2022.5-1+rpi1^2~9^2^2~6^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=60853219d5a78f0c62d1ccb4e3f27585ae5c7ffd;p=ostree.git sysroot: Add a few more assertions about `boot_fd` These places are all safe, but it would catch bugs in the future more clearly to trip an assertion here. --- diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 456b0c04..3b04267c 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -1614,6 +1614,7 @@ full_system_sync (OstreeSysroot *self, return FALSE; start_msec = g_get_monotonic_time () / 1000; + g_assert_cmpint (self->boot_fd, !=, -1); if (!fsfreeze_thaw_cycle (self, self->boot_fd, cancellable, error)) return FALSE; end_msec = g_get_monotonic_time () / 1000; @@ -3526,6 +3527,7 @@ _ostree_sysroot_boot_complete (OstreeSysroot *self, return FALSE; glnx_autofd int failure_fd = -1; + g_assert_cmpint (self->boot_fd, !=, -1); if (!ot_openat_ignore_enoent (self->boot_fd, _OSTREE_FINALIZE_STAGED_FAILURE_PATH, &failure_fd, error)) return FALSE; // If we didn't find a failure log, then there's nothing to do right now.